//import fuse class files
import com.mosesSupposes.fuse.*;
import mx.utils.Delegate;

var menuInt:Number = 0;
var menuOpen:Boolean;

// Creates listener object, focusListener.
var mouseListener:Object = new Object();

// Defines function for listener object.
mouseListener.onMouseMove = Delegate.create(this, mouseMove);
// Registers focusListener with broadcaster.
Mouse.addListener(mouseListener);


//set up zigo
ZigoEngine.simpleSetup(Shortcuts, PennerEasing);


function setMenuTimer() {
	trace("setMenuTimer")
	clearInterval(menuInt)
	menuInt = setInterval(this, "hideMenu", 3000);	
}

function mouseMove() {
	//if mouse is only on chrome
	/*if(!menuOpen && controls_mc.hitTest(_xmouse,_ymouse)) {
		trace("onControls")
		showMenu();
	} else if (menuOpen && !controls_mc.hitTest(_xmouse,_ymouse) && !menu_mc.hitTest(_xmouse,_ymouse)) {
		hideMenu();
	} else {
		setMenuTimer();
	}*/
	//as long as mouse is active.
	if(!menuOpen) {
		showMenu();
	} else {
		setMenuTimer();
	}
}


function showMenu() {
	trace("showMenu")
	menuOpen = true;
	setMenuTimer();
	ZigoEngine.doTween(menu_mc, "_y", 187, 1, "easeInOutExpo", 0);	
}

function hideMenu() {
	trace("hideMenu")
	menuOpen = false;
	clearInterval(menuInt);
	ZigoEngine.doTween(menu_mc, "_y", 207, 1, "easeInOutExpo", 0);	
}


